Flappy Bird

One of my favorite side projects has been creating a Pygame version of the classic Flappy Bird game. In this project, I utilized Pygame, a popular library for game development in Python, to build a fully functional game. I began by setting up the necessary libraries and defining constants for the game's frame rate, animation speed, and window dimensions. I created a Bird class to represent the player's character, handling its movement and animation to mimic a flapping motion. I also developed a PipePair class to generate and manage the obstacle pipes, including their random heights and collision detection. The game loop manages the core logic, updating the bird's position, generating pipes, checking for collisions, and rendering graphics. I implemented event handling to respond to player inputs, such as starting a new game and controlling the bird's movement. Additionally, I added a scoring system to track and display the player's progress, with the game ending if the bird collides with a pipe or the ground. This project allowed me to deepen my understanding of game development and provided valuable experience in creating interactive applications.

Snake Game

Another exciting side project I've worked on is a Pygame version of the classic Snake game. Using Pygame, I handled graphical rendering, user input, and game state management. I set up the game display dimensions, defined colors, and loaded the snake's image. I created a function to draw the snake and its rotating head, as well as functions to render and display text for game messages. An introduction screen allows the player to start or quit the game. The main game loop manages the core logic, updating the snake's position, redrawing the screen, and handling user inputs for changing direction. The game checks for collisions with the screen edges and the snake itself, and when the snake eats an apple, its length increases, and a new apple is randomly placed. The game ends if the snake collides with the edges or itself, displaying a game over message and options to restart or quit. This project enhanced my understanding of game development, particularly in managing game loops, handling user input, and implementing collision detection.

3D Cube

A fascinating side project I've undertaken is developing a 3D graphics program using Pygame and OpenGL. This project involved creating a rotating 3D cube rendered on the screen. I utilized Pygame for setting up the display and managing events, and OpenGL for rendering 3D graphics. The program initializes a display window, sets up perspective projection, and translates the view to ensure the cube is visible. It defines the vertices and edges of the cube and renders them using OpenGL functions. The cube continuously rotates, providing a dynamic visual effect. Additionally, the program includes interactive controls, allowing users to exit the application via a quit event. This project enhanced my skills in 3D graphics programming and interaction design, showcasing the capabilities of combining Pygame and OpenGL.